/**
 * 
 */
package com.ydy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ydy.annotation.StaffToken;
import com.ydy.annotation.UserToken;
import com.ydy.controller.base.BaseController;
import com.ydy.model.Book;
import com.ydy.service.book.BookService;
import com.ydy.vo.other.PageVo;

/**
 * @author xuzhaojie
 *
 *         2019年1月18日 上午9:17:29
 */
@Controller
@RequestMapping(value = "book", name = "预约模块")
public class BookController extends BaseController {

	@Autowired
	private BookService bookService;

	@UserToken
	@GetMapping(value = "list", name = "用户查找预约列表")
	@ResponseBody
	public ResponseEntity<PageVo<Book>> list(Book book, Integer page, Integer size) {
		PageVo<Book> vo = bookService.list(book, getUser(), page, size);
		return ResponseEntity.ok(vo);
	}

	@StaffToken
	@GetMapping(value = "select", name = "店员查找预约列表")
	@ResponseBody
	public ResponseEntity<PageVo<Book>> select(Book book, Integer page, Integer size) {
		PageVo<Book> vo = bookService.select(book, getStaff(), page, size);
		return ResponseEntity.ok(vo);
	}

}